namespace ScrumSprintMonitor.UI.Wpf.Converters
{
	#region #using Directives

	using System;
	using System.Globalization;
	using System.Windows.Data;

	#endregion

	[ValueConversion(typeof(DateTime), typeof(string))]
	public class DateTimeValueConverter : IValueConverter
	{
		#region IValueConverter Members

		public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
		{
			if (value != null && value is DateTime)
			{
				var val = (DateTime) value;

				return string.Format(CultureInfo.CurrentCulture, "{0:" + (string) parameter + "}", val);
			}

			return null;
		}

		public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
		{
			throw new NotSupportedException();
		}

		#endregion
	}
}